<?php
class Default_Model_Product extends Zend_Db_Table_Abstract
{
	public function getall()
	{
		$db = Zend_Registry::get('connectDB');
		$data = $db->fetchAll($db->select()->from('product'));
		return $data;
	}
	public function getidproduct($name)
	{
		$db = Zend_Registry::get('connectDB');
		$data = $db->fetchRow($db->select()->from('product','id_product'));
		return $data;
	}
	public function getallvideo($id)
	{
		$db = Zend_Registry::get('connectDB');
		$data = $db->fetchAll($db->select()->from('urlvideo')->where('id_product =?',$id));
		return $data;
	}
	public function getId($id)
	{
		$db = Zend_Registry::get('connectDB');
		$data = $db->fetchRow($db->select()->from('urlvideo')->where('id_urlvideo =?',$id));
		return $data;
	}
	public function getallnew()
	{
		$db = Zend_Registry::get('connectDB');
		$data = $db->fetchAll($db->select()->from('urlvideo')->where('updatedate =?','2012-07-09'));
		return $data;
	}
	public function getviewcount($id)
	{
		$db = Zend_Registry::get('connectDB');
		$data = $db->fetchRow($db->select()->from('urlvideo','viewcount')->where('id_urlvideo = ?',$id));
	}
	public function viewcount($id,$viewcount)
	{
		$db = Zend_Registry::get('connectDB');
		$where = $db->quoteInto('id_urlvideo =?',$id);
		$data = array('viewcount'=>$viewcount);
		$update = $db->update('urlvideo',$data,$where);
		return $update;
	}
}
